import * as Yup from "yup"
const schema = Yup.object().shape({
	buy_videos: Yup.array().min(1, "名片视频至少上传1个").required("名片视频不能为空"),
	shop_image: Yup.array().min(1, "名片展示图至少上传1个").required("名片展示图不能为空"),
	username: Yup.string().required("不能为空").min(6, "最少输入6个字符").max(30, "最多输入30个字符"),
	reg_time: Yup.string().required("不能为空"),
	reg_address: Yup.string().required("不能为空").min(6, "最少输入6个字符").max(30, "最多输入30个字符"),
	profile: Yup.string().required("不能为空").min(6, "最少输入6个字符").max(200, "最多输入200个字符"),
	main_product: Yup.string().required("不能为空").min(6, "最少输入6个字符").max(50, "最多输入50个字符"),
	provide_transport_id: Yup.string().required("请选择").test("运输方式验证", "请至少选择一种", value => {
		return value && value.split(",")[0]
	}),
	transport_type: Yup.string().required("请选择").test("业务选项验证", "请至少选择一种", value => {
		return value && value.split(",")[0]
	}),
	car_quote: Yup.string().required("请选择").test("车辆与报价验证", "请至少选择一条路线", (value, obj) => {
		try {
			return Object.keys(JSON.parse(value)).length > 0
		} catch (err) {
			return false
		}
	}),
	// license_images: Yup.array(),
	// company_images: Yup.array(),
	// car_images: Yup.array(),
	// transport_images: Yup.array(),
	// service_images: Yup.array(),
})

export default schema